package SpringAOPTest;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.BasicConfigurator;

public class MyInvocationHandler implements InvocationHandler {
    private Object fooClass;
    public MyInvocationHandler(Object fooClass) {

        this.fooClass = fooClass;
    }
    @Override
    public Object invoke(Object arg0, Method arg1, Object[] arg2)throws Throwable
    {
        BasicConfigurator.configure();
        Log log = LogFactory.getLog(MyInvocationHandler.class);
        log.info("This is " + MyInvocationHandler.class.getName() + "You want invoke "+ arg1.getName());

        return arg1.invoke(fooClass,arg2);
    }
}